/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1641437495300_6462';

  // add your middleware config here
  config.middleware = [];
  //mysql config
  config.mysql = {
    // 单数据库信息配置
    client: {
      // host
      host: '127.0.0.1',
      // 端口号
      port: '3306',
      // 用户名
      user: 'root',
      // 密码
      password: '123456',
      // 数据库名
      database: 'printer',
    },
    // 是否加载到 app 上，默认开启
    app: true,
    // 是否加载到 agent 上，默认关闭
    agent: false,
  };

  //jwt 登录校验配置
  // config.jwt = {
  //   secret: 'printer_token',
  // };

  // config.middleware = ['myJwt'];

  // config.myJwt = {
  //   enable: true,
  //   ignore: ['/v1/login','/v1/index','/v1/file/uploadFile'],
  //   secret: 'printer_token'
  // }

  //文件上传插件配置
  config.multipart = {
    mode: 'file',
    //配置白名单
    whitelist: ['.png', '.pdf', '.docx', '.xlsx', '.txt', '.pptx','.doc'],
  };
  config.security = {
    csrf: {
      enable: false,
      ignoreJSON: true,
    },
    domainWhiteList: ['*'],
  };
  config.cors = {
    origin: '*',
    allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
  };

  config.redis = {
    client: {
      port: 6379,          // Redis port
      host: '127.0.0.1',   // Redis host
      password: 'auth',
      db: 0,
    },
  }
  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
